<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>注册</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="res/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="res/layui/css/admin.css" media="all">
  <link rel="stylesheet" href="res/layui/css/login.css" media="all">
</head>
<style>
	body{
		background: url(res/img/bj5.jpg) no-repeat;
		background-size:100% 100%;
	}
	html,body{
		width:100%;
		height:100%;
	}
</style>
<body>
<form method="post" name="loginform" action = "registerAction.action" onsubmit="return loginValidation()">
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>校运动会注册</h2>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="userid" id="userid" lay-verify="required" placeholder="请输入用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="userpwd" id="userpwd" lay-verify="required" placeholder="请输入密码" class="layui-input">
        </div>
         <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="confirmpwd" id="confirmpwd" lay-verify="required" placeholder="确认密码" class="layui-input">
        </div>
      	<div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon" for="LAY-user-login-password"></label>
          <input type="text" name="note" id="note" lay-verify="required" placeholder="请输入昵称" class="layui-input">
        </div>
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">注册</button>
        </div>
       <!--  <div class="layui-form-item">
			<button type="button" id ="login-button" class="layui-btn layui-block" lay-filter="LAY-user-login-submit" lay-submit>注册</button>
		</div>
		
		
		<div class="layui-form-item layui-hide">
	        <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加">
	        <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
	     </div> -->
		
        <div class="layui-trans layui-form-item layadmin-user-login-other">
          <label>社交账号登入</label>
          <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
          <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
          <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
          
          <a href="login.jsp" class="layadmin-user-jump-change layadmin-link">登录</a>
        </div>
      </div>
    </div>
    
    <div class="layui-trans layadmin-user-login-footer">
      
      <p>© 2018 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
      <p>
        <span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
        <span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
        <span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
      </p>
    </div>
    
  </div>
</form>
 <script src="res/layui/layui.js"></script>
 <script src="lib/jquery-3.3.1.js" charset="utf-8"></script>
 <script src="lib/md5.js" charset="utf-8"></script>
<script src="lib/systempublickey.js" charset="utf-8"></script>
<script>
  layui.config({
    base: 'res/js/util/' 
  }).use('firm'); 
</script>
<script>
		layui.use(['table','jquery','upload','form','laydate','layer'], function(){
			var table = layui.table;
		  var $ = layui.jquery;
		  var form=layui.form;
		  var layer = layui.layer,laydate = layui.laydate,upload = layui.upload;
			
			/* 点击登录 ,用jquery判断输入的用户名、密码是否符合条件*/
			$("#login-button").click(function(){
				var userid=$("userid").val();
				var userpwd=$("#userpwd").val();
				var confirmpwd=$("#confirmpwd").val();
				var note=$("#note").val();
		
				if(userid==""){
					layer.tips('用户名', '#userid');
					return;
				}
				if(userpwd==""){
					layer.tips('密码不能为空', '#userpwd');
					return;
				}
				if(userpwd.length<6 || userpwd.length>18){
					layer.alert('密码长度不符合规范!', {icon: 2});
					return;
				}
				if(confirmpwd==""){
					layer.tips('确认不能为空', '#confirmpwd');
					return;
				}
				if(confirmpwd.length<6 || confirmpwd.length>18){
					layer.alert('确认密码长度不符合规范!', {icon: 2});
					return;
				}
				if(confirmpwd != userpwd) {
					layer.tips('密码不一致', '#confirmpwd');
					return;
				}
				if(note==""){
					layer.tips('昵称不能为空', '#note');
					return;
				}
				
				/* 用MD5将密码做加密处理 */
				var enpwd = hex_md5(fix(userid,userpwd));
				$("#user_password").val(enpwd);
				var param = '?userid='+userid+'&userpwd='+enpwd +'&note='+note;//参数组合
				/* alert(enpwd);
				var index = layer.load(0, {shade: 0.1});
				//alert(1);
				$.ajax({
					type : 'get',
					url : '../registerAction'+param,
					datatype : 'json',
					success : function(data) {
						if (data.code == 10001) {
							
							//window.location.href = "index.jsp";
							//document.getElementById("showinput").innerText = data.msg;
							setTimeout("javascript:location.href='index.jsp'", 0);
							
						} else {
							//layer.alert(data.msg, {icon: 2});
							layer.close(index);
							document.getElementById("showinput").innerText = data.msg;
						}
					},
					error:function(){
	    	        	layer.alert(data.msg, {icon: 2});
	    	        	//document.getElementById("showinput").innerText = data.msg;
	    	        }
				}); */
			});
				
			
		});
	</script>
</body>
</html>